#ifndef CONTROLLER_HPP
#define CONTROLLER_HPP
#include "DetatchPanel.hpp"
#include "Panel.hpp"
#include <boost/signals/trackable.hpp>
#include "MenuEvents.hpp"

class ControlPoint;
class GlWindow;
class Camera;
class SelfIntersectionView;
class VertexSelector;
class RegisterDlg;
// root object of the application
class Controller : public boost::signals::trackable
{
   public:
      Controller();
      ~Controller();
      static Controller& GetInstance();

      int handle(int event);
      void Draw();
      void RedrawGl();
      void SetupLighting();
      Camera*    GetCamera() { return mCamera; }
      void SetStatus(const std::string& aStatus);
   private:
      void Exit(const boost::many& args);
      
      void ShowViewWindow();
      Camera*    mCamera;
   public:
      GlWindow*  mGlWindow;
      MainPanel* mMainPanel;
      ViewPanel* mViewPanel;
      MeshPanel* mMeshPanel;
      EditPanel* mEditPanel;
      SimplifySurfaceDlg* mSimplifyDlg;
      MeshPropertiesDlg* mPropertiesDlg;
      MaterialDlg*         mMaterialDlg;
      RegisterDlg*         mRegisterDlg;
      DetatchPanel*        mInterfaceDetatcher;
      VertexSelector*      mVertexSelector;
      ControlPoint*        mControlPoint;
      SelfIntersectionView* mIntersectingView;
      Fl_Box*                 mStatusBar;
};
#endif
